package com.example.medicalretrieval;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.widget.ListView;

import com.example.medicalretrieval.adapter.DownloadHistoryAdapter;
import com.example.medicalretrieval.dao.DownloadHistoryDao;
import com.example.medicalretrieval.pojo.DownloadHistory;

import java.util.List;

public class DownloadHistoryActivity extends AppCompatActivity {

    private DownloadHistoryDao downloadHistoryDao;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_download_history);
        ListView downloadList = findViewById(R.id.downloadList);
        downloadHistoryDao = MyApplication.getInstance().getDownloadHistoryDataBase().downloadHistoryDao();
        List<DownloadHistory> downloadHistoryList = downloadHistoryDao.queryByTimeOfDESC();
        DownloadHistoryAdapter adapter = new DownloadHistoryAdapter(this,downloadHistoryList);
        downloadList.setAdapter(adapter);
    }
}